% make_gould_met5m
% make_gould_met5m creates a 5-min time series
% from the basic edited gould_met1m 1-min data
% using pl66tn(x,1/60/12/60) and subsample to 
% make 5-min series.
% 4/10/01

clear
% get data
load gould_met1m
% clean sw,par, get clean sst
sw=clean_gould_sw(sw);
sopar=clean_gould_par(sopar);
sst=sstn;
% set subsample time
n=[2:5:length(t)]';  
dt1=1/60;dt2=12/60;
% filter and subsample scalars
z=pl66tn(at,dt1,dt2);at=z(n);
z=pl66tn(rh,dt1,dt2);rh=z(n);
z=pl66tn(bp,dt1,dt2);bp=z(n);
z=pl66tn(sw,dt1,dt2);sw=z(n);
z=pl66tn(lw,dt1,dt2);lw=z(n);
z=pl66tn(sst,dt1,dt2);sst=z(n);
z=pl66tn(sss,dt1,dt2);sss=z(n);
z=pl66tn(sopar,dt1,dt2);sopar=z(n);
z=pl66tn(sog,dt1,dt2);sog=z(n);
x=x(n);y=y(n);t=t(n);gyro=gyro(n);
% filter and subsample wind
d2r=pi/180;
wd=wd+180; % convert to oceanographic direction
u=ws.*cos(d2r*wd);
v=ws.*sin(d2r*wd);
uf=pl66tn(u,dt1,dt2);vf=pl66tn(v,dt1,dt2);
u=uf(n);v=vf(n);
ws=sqrt(u.^2+v.^2);
wd=atan2(v,u)./d2r; 

save gould_met5m  t x y at bp rh sst sss sopar sw lw u v ws wd sog gyro
clear 
load gould_met5m
